package com.hyx.spring.config;

import com.hyx.spring.bean.Student;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @Author hyx
 * @Description 将Student类对象通过这个类以注解的方式注册到Spring容器中,验证BEAN的生命周期
 *             @Scope注解将Student对象设置成多实例bean
 * @Date 2024/3/10 19:35
 * @Version 1.0
 */
@Configuration
public class LifeCircleConfig {


    @Scope("prototype")
    @Bean(initMethod = "init",destroyMethod = "destroy")
    public Student student(){
        return new Student();
    }
}
